; (vim.cmd "packadd packer.nvim")
; (vim.cmd "autocmd BufWritePost plugins.fnl PackerCompile")
;;; (vim.cmd "autocmd BufEnter * if (winnr(\"$\") == 1 && exists(\"b:nvim_tree_width\") && b:nvim_tree_width > 0) | wincmd p | endif" )

(local lazypath (.. (vim.fn.stdpath :data) :/lazy/lazy.nvim))
(if (not (vim.loop.fs_stat lazypath))
    (vim.fn.system [:git
                    :clone
                    "--filter=blob:none"
                    "https://github.com/folke/lazy.nvim.git"
                    :--branch=stable
                    lazypath]))

(vim.opt.rtp:prepend lazypath)

(require :config.lazy)
(set vim.opt.laststatus 2)
(set vim.opt.showtabline 2)
(vim.cmd "colorscheme onedark")
;(vim.cmd "colorscheme gruvbox")
(vim.cmd "set guifont=CodeNewRoman\\ Nerd\\ Font\\ Mono:h16")
(set vim.o.completeopt "menuone,noselect")
(fn set-keymap [...] (vim.api.nvim_set_keymap ...))
(local opts {:noremap true :silent true})
(set-keymap :n :<leader>ff
            "<cmd>lua require('telescope.builtin').find_files()<cr>" opts)

(set-keymap :n :<leader>fm
            "<cmd>lua require(('telescope.builtin')).oldfiles()<cr>" opts)

(set-keymap :n :<leader>fg
            "<cmd>lua require(('telescope.builtin')).live_grep()<cr>" opts)

(set-keymap :t :<Esc> "<C-\\><C-n>" opts)

;;(local result (vim.api.nvim_exec "     
;;
;;     set completeopt=menu,menuone,noselect
;;     set encoding=utf-8
;;     set hidden
;;     set nobackup
;;     set nowritebackup
;;     set cmdheight=3
;;     set updatetime=300
;;     set shortmess+=c
;;     set autoindent
;;     set shiftwidth=4
;;     set tags=./.tags;,.tags
;;     syntax on
;;     set number
;;     set backspace=indent,eol,start
;;     set nohlsearch
;;
;;     au BufNewFile,BufRead *.c:SymbolsOutline<CR>
;;
;;     set foldmethod=expr
;;     set foldexpr=nvim_treesitter#foldexpr()
;;     set mouse =
;;     " false))

(local result (vim.api.nvim_exec "     
 set background=light
      set mouse =
      set completeopt=menu,menuone,noselect
      set encoding=utf-8
      set hidden
      set nobackup
     set nowritebackup
     set cmdheight=3
     set updatetime=300
      set shortmess+=c
      set autoindent
      set shiftwidth=4
      set tags=./.tags;,.tags
      syntax on
      set number
      set backspace=indent,eol,start
      set nohlsearch
     set guifont=CodeNewRoman\\ Nerd\\ Font\\ Mono
     let &shell = has('win32') ? 'powershell' : 'bash'
     autocmd FocusGained * checktime
     let g:claude_api_key = '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'
     let g:openai_api_key='sk-qaVU00JmU3twqvEb41Fe96C34aD94476A6Bf486fE5525eA3'
     let g:openai_base_url = 'https://llmhub.app'
     let g:chat_gpt_model='claude-3-5-sonnet-20241022'
     let g:chat_gpt_lang = 'Chinese'
     
    let s:initial_complete_prompt =<< trim END
>>> system
You are a general assistant.
Answer shortly, consisely and only what you are asked.
Do not provide any explanantion or comments if not requested.
If you answer in a code, do not wrap it in markdown code block.
END
    let s:initial_chat_prompt =<< trim END
>>> system
You are a general assistant.
If you attach a code block add syntax type after ``` to enable syntax highlighting.
END

     
            " false))

;;;   autocmd VimEnter * NvimTreeOpen
(local local-vimrc (.. (vim.fn.getcwd) :/.nvimrc))
(when (vim.loop.fs_stat local-vimrc) (vim.cmd (.. "source " local-vimrc)))

